<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Document</title>
    </head>
    <body>
        <div id="app">
           <input v-model="firstName"/>
           <input v-model="lastName"/>
           <p>你的全名是:{{fullName}}</p>
        </div>
        <script src="my-vue.js"></script>
        <script>
        var vm = new Vue({
            el:'#app',
            data:{
                firstName:'zhang',
                lastName:'san'
            },
            computed:{
                fullName:{
                    get(){
                        return this.firstName+this.lastName;
                    },
                    set(newValue){
                        const [firstName,lastName] = newValue.split('|');
                        this.firstName = firstName;
                        this.lastName = lastName;
                    }
                }
            }
        });
        console.log(vm.fullName);
        vm.fullName = 'li|si';
    </script>
    </body>
</html>